package com.marcjmcd.cop4331;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class shortestList extends ListActivity
{
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
				  
		final String[] values = getIntent().getExtras().getStringArray("values");
		
		setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, values));
		
		ListView lv = getListView();
		
		lv.setTextFilterEnabled(true);
		
		lv.setOnItemClickListener(new OnItemClickListener() {
			  
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) 
	    {
		    //When clicked...do this.
			TTS player = new TTS();
			
			System.out.println(values[position]);
			
			player.start(values[position]);
		} 
		});
	}
}
